using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace ForumClient
{
    public class ForumMetaData
    {
        public ForumMetaData()
        {
            _sites = CreateNewSitesTable();
            _groups = CreateNewGroupsTable();
            _forums = CreateNewForumsTable();
        }

        private DataTable _sites;
        private DataTable _groups;
        private DataTable _forums;

        public DataTable Sites
        {
            get
            {
                return _sites;
            }
        }

        public DataTable Groups
        {
            get
            {
                return _groups;
            }
        }

        public DataTable Forums
        {
            get
            {
                return _forums;
            }
        }
      
        private DataTable CreateNewSitesTable()
        {
            DataTable table = new DataTable("Sites");
            DataColumn column = table.Columns.Add("SiteID");
            column.DataType = typeof(int);
            column = table.Columns.Add("SiteName");
            column.DataType = typeof(string);
            column = table.Columns.Add("SiteIsLoaded");
            column.DataType = typeof(bool);

            DataRow dr = table.NewRow();
            dr["SiteID"] = 1;
            dr["SiteName"] = "MSDN";
            dr["SiteIsLoaded"] = false;
            table.Rows.Add(dr);
            dr = table.NewRow();
            dr["SiteID"] = 17;
            dr["SiteName"] = "TechNet";
            dr["SiteIsLoaded"] = false;
            table.Rows.Add(dr);

            return table;
        }

      private DataTable CreateNewGroupsTable()
      {
         DataTable table = new DataTable("Groups");
         DataColumn column = table.Columns.Add("GroupID");
         column.DataType = typeof(int);
         column = table.Columns.Add("GroupName");
         column.DataType = typeof(string);
         column = table.Columns.Add("SiteID");
         column.DataType = typeof(int);
         return table;
      }

      private DataTable CreateNewForumsTable()
      {
         DataTable table = new DataTable("Forums");
         DataColumn column = table.Columns.Add("ForumID");
         column.DataType = typeof(int);
         column = table.Columns.Add("ForumName");
         column.DataType = typeof(string);
         column = table.Columns.Add("GroupID");
         column.DataType = typeof(int);
         return table;
      }
   }
}
